﻿@{
    ViewBag.Title = "常用资源管理";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}
<div class="right_title2">
    <a href="/Navigate/Index">首页</a> ><span>常用资源管理</span></div>
<div class="index_lr">
    <div class="index_lrA_title ui-icons">
        <h3>常用资源管理</h3>
    </div>
    <div class="index_pt_bg">
        <form action="@Url.Action("Admin", "AdminDocument")" method="post" id="documentform" enctype="multipart/form-data">
        <label>名称:</label>
        <input type="text" name="name" id="name" />
        <label>关键字:</label>
        <input type="text" name="keywords" id="keywords" />
        <label>文件:</label>
        <input type="file" name="document1" id="document1" />
        <input type="submit" name="submit" value="上传" />
        </form>
    </div>
    <div class="index_lrA_title ui-icons">
    </div>
    <div class="index_pt_bg" id="ListDocuments">
    </div>
</div>
@section ScriptAndCss{
    <link href="../../Content/css/bsadmin.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        function loadList() {
            $("#ListDocuments").load("@Url.Action("ListAdmin", "AdminDocument")", function () {
                $(".deleteDoc", "#ListDocuments").click(function (e) {
                    var isContinue = confirm("你确定要删除这个文件吗？");
                    if (isContinue) {
                        $.post("@Url.Action("Delete", "AdminDocument")", { id: $(this).attr("data-id") }, function () {
                     loadList();
                     alert("删除成功");
                     location.reload();
                 });
             }
             e.preventDefault();
         });
        });
 }

 $(document).ready(function () {

     loadList();

     $("#documentform").submit(function () {
         var name = $("#name").val();
         var document1 = $("#document1").val();
         var keywords = $("#keywords").val();
         if (name == "" || document1 == ""||keywords=="") {
             alert("名称,关键字或文件为空，请输入或选择!");
             return false;
         }
     });
     // $("#sortAsc")[0].selectedIndex=$("#sortAscValue").val();

     //$("#submitB").click(function () {
     //var url="@Url.Action("ChangeKey", "AdminOther")";  
            //$.post(url,{key:"homepage_system_sort_desc",value:$("#sortAsc").val()},function(){
            //alert("更新成功");
            //});
            // });
        });
    </script>
}
